package com.kun97.im.controller;

import com.kun97.im.dal.mapper.InformNewsMapper;
import com.kun97.im.model.InformNews;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @BelongsProject: im
 * @BelongsPackage: com.kun97.im.controller
 * @Author: zaydanwu
 * @CreateTime: 2019-01-01 17:38
 * @Description:
 */
@RestController
@RequestMapping("/im/api/informnews/")
public class InformNewsController {
    @Resource
    private InformNewsMapper informNewsMapper;

    @RequestMapping("selectAllNews")
    List<InformNews> selectAllNews() {
        return informNewsMapper.select();
    }

    @RequestMapping("updateByPrimaryKey")
    int updateByPrimaryKey(@RequestBody InformNews record) {
        return informNewsMapper.updateByPrimaryKey(record);
    }

    @RequestMapping("insert")
    int insert(@RequestBody InformNews record) {
        return informNewsMapper.insert(record);
    }

    @RequestMapping("deleteByPrimaryKey")
    int deleteByPrimaryKey(@RequestParam Integer id) {
        return informNewsMapper.deleteByPrimaryKey(id);
    }

    @RequestMapping("selectByPrimaryKey")
    InformNews selectByPrimaryKey(Integer id) {
        return informNewsMapper.selectByPrimaryKey(id);
    }
}
